import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

import zhCn from 'element-plus/es/locale/lang/zh-cn'
import axios from 'axios'
import { RegionSelects } from 'v-region'

// 创建 Pinia 实例并使用持久化插件
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)

// 数据访问 - 添加JWT token信息
axios.defaults.headers.common["Authorization"] = "Bearer " + window.localStorage.getItem("token");

const app = createApp(App)

app.use(pinia)
app.use(router)
app.use(ElementPlus, {
  locale: zhCn,
})
app.component('v-region-selects', RegionSelects)

app.mount('#app')
